package com.junit;

import java.io.*;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Arrays;

public class FrameWork {
    public static void main(String[] args) throws Exception {
        FrameWork.storageClass(new MyTest());
    }
    public static void storageClass(Object className) throws Exception {
        Class class1 = className.getClass();
        Constructor[] constructors = class1.getDeclaredConstructors();
        Field[] fields = class1.getDeclaredFields();
        Method[] methods = class1.getDeclaredMethods();
        BufferedWriter buffered = new BufferedWriter(new FileWriter("File.txt"));

        for(Constructor constructor : constructors){
            constructor.setAccessible(true);
            String temp = constructor.getName() + "-->" + Arrays.toString(constructor.getParameterTypes());
            buffered.write(temp + "\n");
        }
        for(Field field : fields){
            field.setAccessible(true);
            String temp = field.getType().getName() + "-->" + field.getType();
            buffered.write(temp + "\n");
        }
        for(Method method : methods){
            method.setAccessible(true);
            String temp = method.getName() + "-->" + Arrays.toString(method.getParameterTypes());
            buffered.write(temp + "\n");
        }
        buffered.close();

    }
}
